﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Data;

namespace BLL.Progect
{	/// <summary>
    /// T_PUB_BRANCHFILE
    /// </summary>
    public partial class T_PUB_BRANCHFILE
    {
        private readonly DALL.Progect.T_PUB_BRANCHFILE dal = new DALL.Progect.T_PUB_BRANCHFILE();
        public T_PUB_BRANCHFILE()
        { }
        #region  Method
        /// <summary>
        /// 增加一条数据
        /// </summary>
        public bool Add(Model.Progect.T_PUB_BRANCHFILE model)
        {
            return dal.Add(model);
        }

        /// <summary>
        /// 更新一条数据
        /// </summary>
        public bool Update(int ID,int branchID)
        {
            return dal.Update(ID,branchID);
        }

        /// <summary>
        /// 删除一条数据
        /// </summary>
        public bool Delete(int ID,string branchID,bool flag)
        {

            return dal.Delete(ID,branchID,flag);
        }

        /// <summary>
        /// 获得数据列表
        /// </summary>
        public DataSet GetList(string strWhere)
        {
            return dal.GetList(strWhere);
        }

        /// <summary>
        /// 获得数据列表
        /// </summary>
        public List<Model.Progect.T_PUB_BRANCHFILE> GetModelList(string strWhere)
        {
            DataSet ds = dal.GetList(strWhere);
            return DataTableToList(ds.Tables[0]);
        }
        /// <summary>
        /// 获得数据列表
        /// </summary>
        public List<Model.Progect.T_PUB_BRANCHFILE> DataTableToList(DataTable dt)
		{
			List<Model.Progect.T_PUB_BRANCHFILE> modelList = new List<Model.Progect.T_PUB_BRANCHFILE>();
			int rowsCount = dt.Rows.Count;
			if (rowsCount > 0)
			{
				Model.Progect.T_PUB_BRANCHFILE model;
				for (int n = 0; n < rowsCount; n++)
				{
					model = new Model.Progect.T_PUB_BRANCHFILE();
					if(dt.Rows[n]["ID"]!=null && dt.Rows[n]["ID"].ToString()!="")
					{
						model.ID=int.Parse(dt.Rows[n]["ID"].ToString());
					}
					if(dt.Rows[n]["BRANCH_ID"]!=null && dt.Rows[n]["BRANCH_ID"].ToString()!="")
					{
					model.BRANCH_ID=dt.Rows[n]["BRANCH_ID"].ToString();
					}
					if(dt.Rows[n]["FILE_ID"]!=null && dt.Rows[n]["FILE_ID"].ToString()!="")
					{
					model.FILE_ID=dt.Rows[n]["FILE_ID"].ToString();
					}
					modelList.Add(model);
				}
			}
			return modelList;
		}

        /// <summary>
        /// 获得数据列表
        /// </summary>
        public DataSet GetAllList()
        {
            return GetList("");
        }
        #endregion  Method
    }
}
